<?php

/**
 * DecReservacion form base class.
 *
 * @method DecReservacion getObject() Returns the current form's model object
 *
 * @package    PhpProject1
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseDecReservacionForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'res_id'             => new sfWidgetFormInputHidden(),
      'res_persona_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('DecPersona'), 'add_empty' => true)),
      'res_promocion'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('DecPromocion'), 'add_empty' => true)),
      'res_fecha_entrada'  => new sfWidgetFormDate(),
      'res_fecha_salida'   => new sfWidgetFormDate(),
      'res_numero_adultos' => new sfWidgetFormInputText(),
      'res_numero_ninos'   => new sfWidgetFormInputText(),
      'res_estado'         => new sfWidgetFormChoice(array('choices' => array('RESERVADO' => 'RESERVADO', 'CONFIRMADO' => 'CONFIRMADO', 'CANCELADO' => 'CANCELADO', 'FINALIZADO' => 'FINALIZADO'))),
    ));

    $this->setValidators(array(
      'res_id'             => new sfValidatorChoice(array('choices' => array($this->getObject()->get('res_id')), 'empty_value' => $this->getObject()->get('res_id'), 'required' => false)),
      'res_persona_id'     => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('DecPersona'), 'required' => false)),
      'res_promocion'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('DecPromocion'), 'required' => false)),
      'res_fecha_entrada'  => new sfValidatorDate(array('required' => false)),
      'res_fecha_salida'   => new sfValidatorDate(array('required' => false)),
      'res_numero_adultos' => new sfValidatorInteger(array('required' => false)),
      'res_numero_ninos'   => new sfValidatorInteger(array('required' => false)),
      'res_estado'         => new sfValidatorChoice(array('choices' => array(0 => 'RESERVADO', 1 => 'CONFIRMADO', 2 => 'CANCELADO', 3 => 'FINALIZADO'), 'required' => false)),
    ));

    $this->widgetSchema->setNameFormat('dec_reservacion[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'DecReservacion';
  }

}
